<?php
	header('content-type:text/html;charset=utf-8');
    $host = "https://ali-weather.showapi.com";
    $path = "/phone-post-code-weeather";
    $method = "GET";
    $appcode = "ab7bfa4f7d544241998ea5d8a8ddb028";
    $headers = array();
    array_push($headers, "Authorization:APPCODE " . $appcode);
    $querys = "need3HourForcast=0&needAlarm=0&needHourData=0&needIndex=0&needMoreDay=0&phone_code=020&post_code=510000";
    $bodys = "";
    $url = $host . $path . "?" . $querys;

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_CUSTOMREQUEST, $method);
    curl_setopt($curl, CURLOPT_URL, $url);
    curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
    curl_setopt($curl, CURLOPT_FAILONERROR, false);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    // curl_setopt($curl, CURLOPT_HEADER, true);
    if (1 == strpos("$".$host, "https://"))
    {
        curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false);
        curl_setopt($curl, CURLOPT_SSL_VERIFYHOST, false);
    }
    $data = curl_exec($curl);

    // var_dump($data);

    var_dump(json_decode($data,true));
?>